package com.lwj.controller;

import com.lwj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.jws.WebParam;
import javax.servlet.http.HttpSession;

/**
 * Created by LWJ on 2018/4/26.
 * 页面控制类
 */

@Controller
public class PageController {

    @Autowired
    private UserService userService;

    @GetMapping("/")
    public ModelAndView index(){
        return new ModelAndView("pages/index");
    }
    @GetMapping("/login")
    public ModelAndView login(){
        return new ModelAndView("pages/login");
    }
    @GetMapping("/register")
    public ModelAndView register(){
        return new ModelAndView("pages/register");
    }
    @GetMapping("/merchant/create")
    public ModelAndView merchantCreate(){
        return new ModelAndView("pages/createProject");
    }

    /**
     * 根据用户名模糊查询
     * @return
     */
    @GetMapping("/serachRes/{userName}")
    public ModelAndView searchRes(@PathVariable String userName, HttpSession session){
        session.setAttribute("userName",userName);
        return new ModelAndView("pages/searchRes");
    }

    @GetMapping("/myProject")
    public ModelAndView myProject(){
        return new ModelAndView("pages/myProject");
    }

    @GetMapping("/myTeam")
    public ModelAndView myTeam(){
        return new ModelAndView("pages/myTeam");
    }

    @GetMapping("/projectList")
    public ModelAndView projectList(){
        return new ModelAndView("pages/projectList");
    }

    @GetMapping("/userProject")
    public ModelAndView userProject(){
        return new ModelAndView("pages/userProject");
    }

    @GetMapping("/detail1")
    public ModelAndView detail1(){
        return new ModelAndView("pages/details01");
    }

    @GetMapping("/detail2")
    public ModelAndView detail2(){
        return new ModelAndView("pages/details02");
    }

    @GetMapping("/detail3")
    public ModelAndView detail3(){
        return new ModelAndView("pages/details03");
    }

    @GetMapping("/connect")
    public ModelAndView connect(){
        return new ModelAndView("pages/connect");
    }
}
